import React from 'react';
import { IntlProvider } from 'react-intl';
import { ConfigProvider, Modal, message } from 'antd';
import intlHelper from '@/shared/utils/intlHelper';
import Globalize from '@/shared/services/i18n/Globalize';

const { getMessages } = intlHelper;

const prefixCls = __PREFIX_CLS__;

Modal.config({ rootPrefixCls: prefixCls });
message.config({ prefixCls: `${prefixCls}-message` });

const Root = ({ children }) => (
  <IntlProvider locale={Globalize.locale} messages={getMessages()[Globalize.locale]}>
    <ConfigProvider prefixCls={prefixCls}>
      {children}
    </ConfigProvider>
  </IntlProvider>
);

export default Root;
